home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / csstray / csstray.exe / _SETUP.1 / frmEx1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-01-25  |  10.4 KB  |  292 lines

  1. VERSION 5.00
  2. Object = "{0DE92B77-C272-11D1-82B4-E5132F8CF155}#8.0#0"; "csstray.ocx"
  3. Begin VB.Form frmEx1 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "SysTray Example Application #1"
  6.    ClientHeight    =   5895
  7.    ClientLeft      =   150
  8.    ClientTop       =   435
  9.    ClientWidth     =   5535
  10.    Icon            =   "frmEx1.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   5895
  14.    ScaleWidth      =   5535
  15.    StartUpPosition =   1  'CenterOwner
  16.    Begin csSysTrayCtl.csSysTray csSysTray2 
  17.       Left            =   3000
  18.       Top             =   2280
  19.       _ExtentX        =   2064
  20.       _ExtentY        =   1111
  21.       TrayIcon        =   "frmEx1.frx":0442
  22.       TrayTip         =   "Look; a second icon!"
  23.       TrayVisible     =   0   'False
  24.       p_RegCode       =   "frmEx1.frx":0894
  25.    End
  26.    Begin VB.CheckBox chkSecondIcon 
  27.       Caption         =   "Show another icon in the system tray!"
  28.       Height          =   255
  29.       Left            =   120
  30.       TabIndex        =   9
  31.       Top             =   5580
  32.       Width           =   3855
  33.    End
  34.    Begin VB.CheckBox chkShowIcon 
  35.       Caption         =   "Show the icon in the system tray."
  36.       Height          =   255
  37.       Left            =   120
  38.       TabIndex        =   8
  39.       Top             =   5340
  40.       Width           =   3855
  41.    End
  42.    Begin VB.TextBox txtTooltip 
  43.       Height          =   345
  44.       Left            =   120
  45.       TabIndex        =   0
  46.       Top             =   4920
  47.       Width           =   3735
  48.    End
  49.    Begin csSysTrayCtl.csSysTray csSysTray1 
  50.       Left            =   4200
  51.       Top             =   2280
  52.       _ExtentX        =   2064
  53.       _ExtentY        =   1111
  54.       TrayIcon        =   "frmEx1.frx":08B4
  55.       TrayTip         =   "SysTray Example Application #1"
  56.       p_RegCode       =   "frmEx1.frx":0D06
  57.    End
  58.    Begin VB.CommandButton cmdClose 
  59.       Cancel          =   -1  'True
  60.       Caption         =   "&Close"
  61.       Default         =   -1  'True
  62.       Height          =   375
  63.       Left            =   4320
  64.       TabIndex        =   2
  65.       Top             =   5400
  66.       Width           =   1095
  67.    End
  68.    Begin VB.ListBox lstEvents 
  69.       Height          =   2010
  70.       Left            =   120
  71.       TabIndex        =   1
  72.       Top             =   2520
  73.       Width           =   5295
  74.    End
  75.    Begin VB.Label Label1 
  76.       AutoSize        =   -1  'True
  77.       Caption         =   "Type the tooltip for the SysTray icon below:"
  78.       BeginProperty Font 
  79.          Name            =   "MS Sans Serif"
  80.          Size            =   8.25
  81.          Charset         =   0
  82.          Weight          =   700
  83.          Underline       =   0   'False
  84.          Italic          =   0   'False
  85.          Strikethrough   =   0   'False
  86.       EndProperty
  87.       Height          =   195
  88.       Left            =   120
  89.       TabIndex        =   7
  90.       Top             =   4680
  91.       Width           =   3735
  92.    End
  93.    Begin VB.Label Label5 
  94.       Caption         =   $"frmEx1.frx":0D26
  95.       BeginProperty Font 
  96.          Name            =   "MS Sans Serif"
  97.          Size            =   8.25
  98.          Charset         =   0
  99.          Weight          =   700
  100.          Underline       =   0   'False
  101.          Italic          =   0   'False
  102.          Strikethrough   =   0   'False
  103.       EndProperty
  104.       Height          =   1125
  105.       Left            =   120
  106.       TabIndex        =   6
  107.       Top             =   1320
  108.       Width           =   5055
  109.    End
  110.    Begin VB.Label Label4 
  111.       Caption         =   $"frmEx1.frx":0E31
  112.       BeginProperty Font 
  113.          Name            =   "MS Sans Serif"
  114.          Size            =   8.25
  115.          Charset         =   0
  116.          Weight          =   700
  117.          Underline       =   0   'False
  118.          Italic          =   0   'False
  119.          Strikethrough   =   0   'False
  120.       EndProperty
  121.       Height          =   665
  122.       Left            =   120
  123.       TabIndex        =   5
  124.       Top             =   600
  125.       Width           =   5055
  126.    End
  127.    Begin VB.Label Label3 
  128.       Caption         =   "This example application shows just how easy it is to use the SysTray control in your own application."
  129.       BeginProperty Font 
  130.          Name            =   "MS Sans Serif"
  131.          Size            =   8.25
  132.          Charset         =   0
  133.          Weight          =   700
  134.          Underline       =   0   'False
  135.          Italic          =   0   'False
  136.          Strikethrough   =   0   'False
  137.       EndProperty
  138.       Height          =   495
  139.       Left            =   120
  140.       TabIndex        =   4
  141.       Top             =   120
  142.       Width           =   5055
  143.    End
  144.    Begin VB.Label Label2 
  145.       Caption         =   "^^ EVENTS ^^"
  146.       BeginProperty Font 
  147.          Name            =   "MS Sans Serif"
  148.          Size            =   8.25
  149.          Charset         =   0
  150.          Weight          =   700
  151.          Underline       =   0   'False
  152.          Italic          =   0   'False
  153.          Strikethrough   =   0   'False
  154.       EndProperty
  155.       Height          =   255
  156.       Left            =   4080
  157.       TabIndex        =   3
  158.       Top             =   4680
  159.       Width           =   1335
  160.    End
  161.    Begin VB.Menu mnuSysTray 
  162.       Caption         =   "SysTray"
  163.       Visible         =   0   'False
  164.       Begin VB.Menu mnuSysTrayAbout 
  165.          Caption         =   "&About SysTray"
  166.       End
  167.       Begin VB.Menu mnuSysTraySep 
  168.          Caption         =   "-"
  169.       End
  170.       Begin VB.Menu mnuSysTrayClose 
  171.          Caption         =   "&Close Program"
  172.       End
  173.    End
  174. Attribute VB_Name = "frmEx1"
  175. Attribute VB_GlobalNameSpace = False
  176. Attribute VB_Creatable = False
  177. Attribute VB_PredeclaredId = True
  178. Attribute VB_Exposed = False
  179. Option Explicit
  180. 'Example program for SysTray Control
  181. '(C) Copyright 1998 Charon Software, All Rights Reserved
  182. 'You may use or modify this code in any way you see fit.
  183. 'Charon Software takes no responsibility for what you may
  184. 'do with this or any modification of this code.
  185. Private Sub chkSecondIcon_Click()
  186.     'if the user clicks on this checkbox, toggle the visible
  187.     'property of the system tray icon.
  188.     csSysTray2.TrayVisible = chkSecondIcon.Value
  189. End Sub
  190. Private Sub chkShowIcon_Click()
  191.     'if the user clicks on this checkbox, toggle the visible
  192.     'property of the system tray icon.
  193.     csSysTray1.TrayVisible = chkShowIcon.Value
  194. End Sub
  195. Private Sub cmdClose_Click()
  196.     'pretty self-explanatory; just unload the form.  The system
  197.     'tray icons will go away automatically!
  198.     Unload Me
  199. End Sub
  200. Private Sub csSysTray1_Click()
  201.     'for this example, we report the event in a listbox.
  202.     lstEvents.AddItem "Event: Click"
  203.     lstEvents.ListIndex = lstEvents.ListCount - 1
  204. End Sub
  205. Private Sub csSysTray1_DblClick()
  206.     'for this example, we report the event in a listbox.
  207.     lstEvents.AddItem "Event: DblClick"
  208.     lstEvents.ListIndex = lstEvents.ListCount - 1
  209. End Sub
  210. Private Sub csSysTray1_MiddleClick()
  211.     'for this example, we report the event in a listbox.
  212.     lstEvents.AddItem "Event: MiddleClick"
  213.     lstEvents.ListIndex = lstEvents.ListCount - 1
  214. End Sub
  215. Private Sub csSysTray1_MiddleDblClick()
  216.     'for this example, we report the event in a listbox.
  217.     lstEvents.AddItem "Event: MiddleDblClick"
  218.     lstEvents.ListIndex = lstEvents.ListCount - 1
  219. End Sub
  220. Private Sub csSysTray1_MouseDown(Button As Integer)
  221.     'for this example, we report the event in a listbox.
  222.     lstEvents.AddItem "Event: MouseDown, Button:" + Str(Button)
  223.     lstEvents.ListIndex = lstEvents.ListCount - 1
  224. End Sub
  225. Private Sub csSysTray1_MouseMove()
  226.     'for this example, we report the event in a listbox.
  227.     lstEvents.AddItem "Event: MouseMove"
  228.     lstEvents.ListIndex = lstEvents.ListCount - 1
  229. End Sub
  230. Private Sub csSysTray1_MouseUp(Button As Integer)
  231.     'for this example, we report the event in a listbox.
  232.     lstEvents.AddItem "Event: MouseUp, Button:" + Str(Button)
  233.     lstEvents.ListIndex = lstEvents.ListCount - 1
  234. End Sub
  235. Private Sub csSysTray1_RightClick()
  236.     'for this example, we report the event in a listbox.
  237.     lstEvents.AddItem "Event: RightClick"
  238.     lstEvents.ListIndex = lstEvents.ListCount - 1
  239.     'since the user right-clicked the icon, pop up a menu!
  240.     'the vbPopupMenuRightButton flag allows both our right and
  241.     'left mouse buttons to be able to choose menu items, instead
  242.     'of just the left button.
  243.     'note that we use the SysTray's PopupMenu method.  Using this
  244.     'method will ensure that our popup menu goes away when it should.
  245.     csSysTray1.PopupMenu mnuSysTray, vbPopupMenuRightButton
  246.     'you could also add the "default" menu item as the last parameter
  247.     'in PopUpMenu. That would indicate that single left-clicking the
  248.     'icon would do the same thing. It's not included here because
  249.     'double left-clicking just shows your mouse events instead.
  250.     'To do this, you would use a command like the following:
  251. '    csSysTray1.PopupMenu mnuSysTray, vbPopupMenuRightButton, , , mnuSysTrayAbout
  252. End Sub
  253. Private Sub csSysTray1_RightDblClick()
  254.     'for this example, we report the event in a listbox.
  255.     lstEvents.AddItem "Event: RightDblClick"
  256.     lstEvents.ListIndex = lstEvents.ListCount - 1
  257. End Sub
  258. Private Sub Form_Load()
  259.     'here, we do some initializion.  We set the text of
  260.     'of our textbox to the current tooltip of the system
  261.     'tray icon.  We also set the checked properties of our
  262.     'checkboxes to the appropriate values.
  263.     txtTooltip.Text = csSysTray1.TrayTip
  264.     If csSysTray1.TrayVisible = True Then
  265.         chkShowIcon.Value = vbChecked
  266.     Else
  267.         chkShowIcon.Value = vbUnchecked
  268.     End If
  269.     If csSysTray2.TrayVisible = True Then
  270.         chkSecondIcon.Value = vbChecked
  271.     Else
  272.         chkSecondIcon.Value = vbUnchecked
  273.     End If
  274.     txtTooltip.SelStart = Len(txtTooltip.Text)
  275. End Sub
  276. Private Sub Form_Unload(Cancel As Integer)
  277.     csSysTray1.ZoomToTray Me.hWnd
  278. End Sub
  279. Private Sub Label5_Click()
  280. End Sub
  281. Private Sub mnuSysTrayAbout_Click()
  282.     csSysTray1.AboutBox
  283. End Sub
  284. Private Sub mnuSysTrayClose_Click()
  285.     'simple enough: close down our program.
  286.     Unload Me
  287. End Sub
  288. Private Sub txtTooltip_Change()
  289.     'change the tooltip on the system tray icon.
  290.     csSysTray1.TrayTip = txtTooltip.Text
  291. End Sub
  292.